package com.mlk.repair.api;

import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.repair.po.EngRepairTicket;
import com.mlk.repair.po.EngRepairTicketPic;
import com.mlk.repair.service.EngRepairService;
import com.mlk.repair.vo.EngRepairTicketVO;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 报备部分的处理内容
 */
@RestController
@RequestMapping("/api/repair")
public class EngRepairAPI {

    @Resource
    private EngRepairService engRepairService;

    /**
     * 上传报备图片
     * @param pic
     * @param file
     * @return
     */
    @PostMapping("addPic")
    public ServerResponse addPic(EngRepairTicketPic pic, MultipartFile file){
        return this.engRepairService.addPic(pic,file);
    }

    /**
     * 删除报备的图片
     */
    @GetMapping("delPic")
    public ServerResponse delPic(Integer id){
        return this.engRepairService.delPic(id);
    }

    /**
     * 添加报备单
     * @return
     */
    @PostMapping("addTicket")
    public ServerResponse addTicket(@RequestBody  EngRepairTicketVO vo){
        return this.engRepairService.addTicket(vo);
    }

    /**
     * 查询我的报备单
     * @return
     */
    @GetMapping("queryMyRepair")
    public Pager queryMyRepair(String openId){
        return this.engRepairService.queryMyRepair(openId);
    }

    /**
     * 查询报备单详情
     * @return
     */
    @GetMapping("queryRepairTickInfo")
    public ServerResponse queryRepairTickInfo(String ticketId){
        return this.engRepairService.queryRepairTickInfo(ticketId);
    }

    /**
     * 智能输入
     * @return
     */
    @GetMapping("AIInput")
    public ServerResponse AIInput(EngRepairTicket ticket){
        return this.engRepairService.AIInput(ticket);
    }
}
